<!DOCTYPE html>
<html lang="zh" xmlns:th="http://www.thymeleaf.org">
    <head>
        <th:block th:include="include :: header('修改生成信息')"/>
        <th:block th:include="include :: select2-css"/>
        <style type="text/css">
            .select-table table {
                table-layout: fixed;
            }

            .table > thead > tr > th {
                text-align: center;
            }

            .select-table .table td {
                overflow: hidden;
                text-overflow: ellipsis;
                white-space: nowrap;
            }

            .form-control {
                padding: 3px 6px 4px;
                height: 30px;
            }

            .icheckbox-blue {
                top: 0px;
                left: 6px;
            }

            .form-control.select2-hidden-accessible {
                position: static !important;
            }

            .select-table table label.error {
                position: inherit;
            }

            select + label.error {
                z-index: 1;
                right: 40px;
            }
        </style>
    </head>
    <body class="gray-bg"
          style="font: 14px Helvetica Neue, Helvetica, PingFang SC, 微软雅黑, Tahoma, Arial, sans-serif !important;">
        <section class="section-content">
            <div class="row">
                <div class="col-xs-12">
                    <div class="ibox float-e-margins">
                        <div class="ibox-content" style="border-style:none;">
                            <div class="nav-tabs-custom">
                                <ul class="nav nav-tabs">
                                    <li><a aria-expanded="false" data-toggle="tab" href="#tab-basic">基本信息</a></li>
                                    <li class="active"><a aria-expanded="true" data-toggle="tab"
                                                          href="#tab-field">字段信息</a></li>
                                    <li><a aria-expanded="false" data-toggle="tab" href="#tab-gen">生成信息</a></li>
                                    <li class="pull-right header">
                                        <i class="fa fa-code"></i> 生成配置
                                    </li>
                                </ul>
                                <form class="form-horizontal" id="form-gen-edit" th:object="${table}">
                                    <input name="tableId" th:field="*{tableId}" type="hidden"/>
                                    <div class="tab-content">
                                        <!-- 基本信息 -->
                                        <div class="tab-pane" id="tab-basic">
                                            <div class="row mt20">
                                                <div class="col-sm-6">
                                                    <div class="form-group">
                                                        <label class="col-sm-4 control-label is-required">表名称：</label>
                                                        <div class="col-sm-8">
                                                            <input class="form-control" maxlength="200" name="tableName"
                                                                   placeholder="请输入表名称" required
                                                                   th:field="*{tableName}" type="text">
                                                        </div>
                                                    </div>
                                                </div>
                                                <div class="col-sm-6">
                                                    <div class="form-group">
                                                        <label class="col-sm-4 control-label is-required">表描述：</label>
                                                        <div class="col-sm-8">
                                                            <input class="form-control" maxlength="500"
                                                                   name="tableComment"
                                                                   placeholder="请输入表描述" required
                                                                   th:field="*{tableComment}" type="text">
                                                        </div>
                                                    </div>
                                                </div>
                                            </div>
                                            <div class="row">
                                                <div class="col-sm-6">
                                                    <div class="form-group">
                                                        <label class="col-sm-4 control-label is-required">实体类名称：</label>
                                                        <div class="col-sm-8">
                                                            <input class="form-control" maxlength="100" name="className"
                                                                   placeholder="请输入实体类名称" required
                                                                   th:field="*{className}" type="text">
                                                        </div>
                                                    </div>
                                                </div>
                                                <div class="col-sm-6">
                                                    <div class="form-group">
                                                        <label class="col-sm-4 control-label is-required">作者：</label>
                                                        <div class="col-sm-8">
                                                            <input class="form-control" maxlength="50"
                                                                   name="functionAuthor" placeholder="请输入作者"
                                                                   required
                                                                   th:field="*{functionAuthor}" type="text">
                                                        </div>
                                                    </div>
                                                </div>
                                            </div>
                                            <div class="row">
                                                <div class="col-sm-12">
                                                    <div class="form-group">
                                                        <label class="col-xs-2 control-label">备注：</label>
                                                        <div class="col-xs-10">
                                                            <textarea class="form-control" maxlength="500" name="remark"
                                                                      rows="3"></textarea>
                                                        </div>
                                                    </div>
                                                </div>
                                            </div>
                                        </div>

                                        <!-- 字段信息 -->
                                        <div class="tab-pane active" id="tab-field">
                                            <div class="select-table table-striped"
                                                 style="margin-top: 0px;padding-top: 0px;padding-bottom: 0px;">
                                                <table data-reorderable-rows="true" data-use-row-attr-func="true"
                                                       id="bootstrap-table"></table>
                                            </div>
                                        </div>

                                        <!-- 生成信息 -->
                                        <div class="tab-pane" id="tab-gen">
                                            <div class="row mt20">
                                                <div class="col-sm-6">
                                                    <div class="form-group">
                                                        <label class="col-sm-4 control-label is-required">生成模板：</label>
                                                        <div class="col-sm-8">
                                                            <select class='form-control' id="tplCategory"
                                                                    name='tplCategory' style="width: 100%">
                                                                <option th:field="*{tplCategory}" value="crud">
                                                                    单表（增删改查）
                                                                </option>
                                                                <option th:field="*{tplCategory}" value="tree">
                                                                    树表（增删改查）
                                                                </option>
                                                                <option th:field="*{tplCategory}" value="sub">
                                                                    主子表（增删改查）
                                                                </option>
                                                            </select>
                                                        </div>
                                                    </div>
                                                </div>
                                                <div class="col-sm-6">
                                                    <div class="form-group">
                                                        <label class="col-sm-4 control-label is-required"
                                                               title="生成在哪个java包下，例如 com.ruoyi.project.system">生成包路径：<i
                                                                class="fa fa-question-circle-o"></i></label>
                                                        <div class="col-sm-8">
                                                            <input class="form-control" maxlength="100"
                                                                   name="packageName"
                                                                   placeholder="请输入生成包路径" required
                                                                   th:field="*{packageName}" type="text">
                                                        </div>
                                                    </div>
                                                </div>
                                            </div>
                                            <div class="row">
                                                <div class="col-sm-6">
                                                    <div class="form-group">
                                                        <label class="col-sm-4 control-label is-required"
                                                               title="可理解为子系统名，例如 system">生成模块名：<i
                                                                class="fa fa-question-circle-o"></i></label>
                                                        <div class="col-sm-8">
                                                            <input class="form-control" maxlength="30" name="moduleName"
                                                                   placeholder="请输入生成模块名" required
                                                                   th:field="*{moduleName}" type="text">
                                                        </div>
                                                    </div>
                                                </div>
                                                <div class="col-sm-6">
                                                    <div class="form-group">
                                                        <label class="col-sm-4 control-label is-required"
                                                               title="可理解为功能英文名，例如 user">生成业务名：<i
                                                                class="fa fa-question-circle-o"></i></label>
                                                        <div class="col-sm-8">
                                                            <input class="form-control" maxlength="50"
                                                                   name="businessName"
                                                                   placeholder="请输入生成业务名" required
                                                                   th:field="*{businessName}" type="text">
                                                        </div>
                                                    </div>
                                                </div>
                                            </div>
                                            <div class="row">
                                                <div class="col-sm-6">
                                                    <div class="form-group">
                                                        <label class="col-sm-4 control-label is-required"
                                                               title="用作类描述，例如 用户">生成功能名：<i
                                                                class="fa fa-question-circle-o"></i></label>
                                                        <div class="col-sm-8">
                                                            <input class="form-control" maxlength="50"
                                                                   name="functionName"
                                                                   placeholder="请输入生成功能名" required
                                                                   th:field="*{functionName}" type="text">
                                                        </div>
                                                    </div>
                                                </div>
                                                <div class="col-sm-6">
                                                    <div class="form-group">
                                                        <label class="col-sm-4 control-label is-required"
                                                               title="选择表单的栅格布局方式">表单布局：<i
                                                                class="fa fa-question-circle-o"></i></label>
                                                        <div class="col-sm-8">
                                                            <select class='form-control' id="formColNum"
                                                                    name='formColNum' style="width: 100%">
                                                                <option th:field="*{formColNum}" value="1">单列</option>
                                                                <option th:field="*{formColNum}" value="2">双列</option>
                                                                <option th:field="*{formColNum}" value="3">三列</option>
                                                            </select>
                                                        </div>
                                                    </div>
                                                </div>
                                            </div>
                                            <div class="row">
                                                <div class="col-sm-6">
                                                    <div class="form-group">
                                                        <label class="col-sm-4 control-label"
                                                               title="默认为zip压缩包下载，也可以自定义生成路径">生成代码方式：<i
                                                                class="fa fa-question-circle-o"></i></label>
                                                        <div class="col-sm-8">
                                                            <label class="radio-box"> <input name="genType"
                                                                                             th:field="*{genType}"
                                                                                             type="radio"
                                                                                             value="0"/>
                                                                zip压缩包 </label>
                                                            <label class="radio-box"> <input name="genType"
                                                                                             th:field="*{genType}"
                                                                                             type="radio"
                                                                                             value="1"/>
                                                                自定义路径</label>
                                                        </div>
                                                    </div>
                                                </div>
                                                <div class="col-sm-6">
                                                    <div class="form-group">
                                                        <label class="col-sm-4 control-label is-required"
                                                               title="分配到指定菜单下，例如 系统管理">上级菜单：<i
                                                                class="fa fa-question-circle-o"></i></label>
                                                        <div class="col-sm-8">
                                                            <input id="parentMenuId" name="params[parentMenuId]"
                                                                   th:value="*{parentMenuId}" type="hidden"/>
                                                            <div class="input-group">
                                                                <input class="form-control" id="parentMenuName"
                                                                       maxlength="50" name="params[parentMenuName]"
                                                                       onclick="selectMenuTree()"
                                                                       placeholder="请选择上级菜单" required
                                                                       th:value="*{parentMenuName}" type="text">
                                                                <span class="input-group-addon"><i
                                                                        class="fa fa-search"></i></span>
                                                            </div>
                                                        </div>
                                                    </div>
                                                </div>
                                            </div>
                                            <div class="hidden row" id="pathinfo">
                                                <div class="col-sm-12">
                                                    <div class="form-group">
                                                        <label class="col-xs-2 control-label"
                                                               title="填写磁盘绝对路径，若不填写，则生成到当前Web项目下">生成基础路径：<i
                                                                class="fa fa-question-circle-o"></i></label>
                                                        <div class="col-xs-10">
                                                            <div class="input-group input-group-sm">
                                                                <input class="form-control" id="genPath" maxlength="200"
                                                                       name="genPath" placeholder="请输入项目路径"
                                                                       th:field="*{genPath}" type="text">
                                                                <div class="input-group-btn">
                                                                    <button class="btn btn-default dropdown-toggle"
                                                                            data-toggle="dropdown"
                                                                            type="button">最近路径快速选择
                                                                        <span class="caret"></span></button>
                                                                    <ul class="dropdown-menu dropdown-menu-right"
                                                                        role="menu">
                                                                        <li><a href="javascript:$('#genPath').val('/')"><i
                                                                                class="fa fa-refresh"></i>恢复默认的生成基础路径</a>
                                                                        </li>
                                                                    </ul>
                                                                </div>
                                                            </div>
                                                        </div>
                                                    </div>
                                                </div>
                                            </div>
                                            <div class="hidden" id="subInfo">
                                                <h4 class="form-header h4">关联信息</h4>
                                                <div class="row">
                                                    <div class="col-sm-6">
                                                        <div class="form-group">
                                                            <label class="col-sm-4 control-label is-required"
                                                                   title="关联子表的表名， 如：sys_user">关联子表的表名：<i
                                                                    class="fa fa-question-circle-o"></i></label>
                                                            <div class="col-sm-8">
                                                                <select class='type form-control' id="subTableName"
                                                                        name='subTableName'
                                                                        style="width: 100%"
                                                                        th:attr='data-value=*{subTableName}'>
                                                                    <option value="">---请选择---</option>
                                                                </select>
                                                            </div>
                                                        </div>
                                                    </div>
                                                    <div class="col-sm-6">
                                                        <div class="form-group">
                                                            <label class="col-sm-4 control-label is-required"
                                                                   title="子表关联的外键名， 如：user_id">子表关联的外键名：<i
                                                                    class="fa fa-question-circle-o"></i></label>
                                                            <div class="col-sm-8">
                                                                <select class='router form-control' id="subTableFkName"
                                                                        name='subTableFkName'
                                                                        style="width: 100%"
                                                                        th:attr='data-value=*{subTableFkName}'>
                                                                    <option value="">---请选择---</option>
                                                                </select>
                                                            </div>
                                                        </div>
                                                    </div>
                                                </div>
                                            </div>
                                            <div class="hidden" id="otherInfo">
                                                <h4 class="form-header h4">其他信息</h4>
                                                <div class="row">
                                                    <div class="col-sm-6">
                                                        <div class="form-group">
                                                            <label class="col-sm-4 control-label is-required"
                                                                   title="树显示的编码字段名， 如：dept_id">树编码字段：<i
                                                                    class="fa fa-question-circle-o"></i></label>
                                                            <div class="col-sm-8">
                                                                <select class='form-control' id="treeCode"
                                                                        name='params[treeCode]' style="width: 100%">
                                                                    <option value="">---请选择---</option>
                                                                    <option th:each="column : ${table.columns}"
                                                                            th:field="*{treeCode}"
                                                                            th:text="${column.columnName + '：' + column.columnComment}"
                                                                            th:value="${column.columnName}"></option>
                                                                </select>
                                                            </div>
                                                        </div>
                                                    </div>
                                                    <div class="col-sm-6">
                                                        <div class="form-group">
                                                            <label class="col-sm-4 control-label is-required"
                                                                   title="树显示的父编码字段名， 如：parent_Id">树父编码字段：<i
                                                                    class="fa fa-question-circle-o"></i></label>
                                                            <div class="col-sm-8">
                                                                <select class='form-control' id="treeParentCode"
                                                                        name='params[treeParentCode]'
                                                                        style="width: 100%">
                                                                    <option value="">---请选择---</option>
                                                                    <option th:each="column : ${table.columns}"
                                                                            th:field="*{treeParentCode}"
                                                                            th:text="${column.columnName + '：' + column.columnComment}"
                                                                            th:value="${column.columnName}"></option>
                                                                </select>
                                                            </div>
                                                        </div>
                                                    </div>
                                                </div>
                                                <div class="row">
                                                    <div class="col-sm-6">
                                                        <div class="form-group">
                                                            <label class="col-sm-4 control-label is-required"
                                                                   title="树节点的显示名称字段名， 如：dept_name">树名称字段：<i
                                                                    class="fa fa-question-circle-o"></i></label>
                                                            <div class="col-sm-8">
                                                                <select class='form-control' id="treeName"
                                                                        name='params[treeName]' style="width: 100%">
                                                                    <option value="">---请选择---</option>
                                                                    <option th:each="column : ${table.columns}"
                                                                            th:field="*{treeName}"
                                                                            th:text="${column.columnName + '：' + column.columnComment}"
                                                                            th:value="${column.columnName}"></option>
                                                                </select>
                                                            </div>
                                                        </div>
                                                    </div>
                                                </div>
                                            </div>
                                        </div>
                                    </div>
                                </form>
                            </div>
                        </div>
                        <div class="box-footer">
                            <div class="col-sm-offset-5 col-sm-6">
                                <button class="btn btn-sm btn-primary" onclick="submitHandler()" type="button"><i
                                        class="fa fa-check"></i>保 存
                                </button>&nbsp;
                                <button class="btn btn-sm btn-danger" onclick="closeItem()" type="button"><i
                                        class="fa fa-reply-all"></i>关 闭
                                </button>
                            </div>
                        </div>
                    </div>
                </div>
            </div>
        </section>
        <th:block th:include="include :: footer"/>
        <th:block th:include="include :: select2-js"/>
        <th:block th:include="include :: bootstrap-table-reorder-rows-js"/>
        <script th:src="@{/js/jquery.tmpl.js}"></script>
        <th:block th:include="include :: jquery-cxselect-js"/>
        <script th:inline="javascript">
            /* 用户信息-修改 */
            $("#form-table-edit").validate({
                rules: {
                    tableName: {
                        required: true,
                    },
                },
                focusCleanup: true
            });

            /* 表级联信息 */
            var data = [[${data}]];
            $('#subInfo').cxSelect({
                selects: ['type', 'router'],
                jsonValue: 'v',
                data: data
            });

            function submitHandler() {
                if ($.validate.form()) {
                    $.operate.saveTab(prefix + "/edit", $("#form-gen-edit").serializeArray());
                }
            }

            var prefix = ctx + "tool/gen";
            $(function () {
                var options = {
                    url: prefix + "/column/list",
                    sidePagination: "client",
                    sortName: "sort",
                    sortOrder: "desc",
                    height: $(window).height() - 166,
                    pagination: false,
                    showSearch: false,
                    showRefresh: false,
                    showToggle: false,
                    showColumns: false,
                    onLoadSuccess: onLoadSuccess,
                    onReorderRow: onReorderRow,
                    columns: [{
                        title: "序号",
                        width: "5%",
                        formatter: function (value, row, index) {
                            // 编号隐藏域
                            var columnIdHtml = $.common.sprintf("<input type='hidden' name='columns[%s].columnId' value='%s'>", index, row.columnId);
                            // 排序隐藏域
                            var sortHtml = $.common.sprintf("<input type='hidden' name='columns[%s].sort' value='%s' id='columns_sort_%s'>", index, row.sort, row.columnId);
                            return columnIdHtml + sortHtml + $.table.serialNumber(index);
                        },
                        cellStyle: function (value, row, index) {
                            return {css: {"cursor": "move"}};
                        }
                    },
                        {
                            field: 'columnName',
                            title: '字段列名',
                            width: "10%",
                            class: "nodrag",
                            cellStyle: function (value, row, index) {
                                return {css: {"cursor": "default"}};
                            }
                        },
                        {
                            field: 'columnComment',
                            title: '字段描述',
                            width: "10%",
                            formatter: function (value, row, index) {
                                var html = $.common.sprintf("<input class='form-control' type='text' name='columns[%s].columnComment' value='%s'>", index, value);
                                return html;
                            }
                        },
                        {
                            field: 'columnType',
                            title: '物理类型',
                            width: "10%",
                            class: "nodrag",
                            cellStyle: function (value, row, index) {
                                return {css: {"cursor": "default"}};
                            }
                        },
                        {
                            field: 'javaType',
                            title: 'Java类型',
                            width: "10%",
                            formatter: function (value, row, index) {
                                var data = [{index: index, javaType: value}];
                                return $("#javaTypeTpl").tmpl(data).html();
                            }
                        },
                        {
                            field: 'javaField',
                            title: 'Java属性',
                            width: "10%",
                            formatter: function (value, row, index) {
                                var html = $.common.sprintf("<input class='form-control' type='text' name='columns[%s].javaField' value='%s' required>", index, value);
                                return html;
                            }
                        },
                        {
                            field: 'isInsert',
                            title: '插入',
                            width: "5%",
                            formatter: function (value, row, index) {
                                var isCheck = value == 1 ? 'checked' : '';
                                var html = $.common.sprintf("<label class='check-box'><input type='checkbox' name='columns[%s].isInsert' value='1' %s></label>", index, isCheck);
                                return html;
                            }
                        },
                        {
                            field: 'isEdit',
                            title: '编辑',
                            width: "5%",
                            formatter: function (value, row, index) {
                                var isCheck = value == 1 ? 'checked' : '';
                                var html = $.common.sprintf("<label class='check-box'><input type='checkbox' name='columns[%s].isEdit' value='1' %s></label>", index, isCheck);
                                return html;
                            }
                        },
                        {
                            field: 'isList',
                            title: '列表',
                            width: "5%",
                            formatter: function (value, row, index) {
                                var isCheck = value == 1 ? 'checked' : '';
                                var html = $.common.sprintf("<label class='check-box'><input type='checkbox' name='columns[%s].isList' value='1' %s></label>", index, isCheck);
                                return html;
                            }
                        },
                        {
                            field: 'isQuery',
                            title: '查询',
                            width: "5%",
                            formatter: function (value, row, index) {
                                var isCheck = value == 1 ? 'checked' : '';
                                var html = $.common.sprintf("<label class='check-box'><input type='checkbox' name='columns[%s].isQuery' value='1' %s></label>", index, isCheck);
                                return html;
                            }
                        },
                        {
                            field: 'queryType',
                            title: '查询方式',
                            width: "10%",
                            formatter: function (value, row, index) {
                                var data = [{index: index, queryType: value}];
                                return $("#queryTypeTpl").tmpl(data).html();
                            }
                        },
                        {
                            field: 'isRequired',
                            title: '必填',
                            width: "5%",
                            formatter: function (value, row, index) {
                                var isCheck = value == 1 ? 'checked' : '';
                                var html = $.common.sprintf("<label class='check-box'><input type='checkbox' name='columns[%s].isRequired' value='1' %s></label>", index, isCheck);
                                return html;
                            }
                        },
                        {
                            field: 'htmlType',
                            title: '显示类型',
                            width: "12%",
                            formatter: function (value, row, index) {
                                var data = [{index: index, htmlType: value}];
                                return $("#htmlTypeTpl").tmpl(data).html();
                            }
                        },
                        {
                            field: 'dictType',
                            title: '字典类型',
                            width: "13%",
                            formatter: function (value, row, index) {
                                var html = $.common.sprintf("<input class='form-control' type='text' name='columns[%s].dictType' value='%s' id='columns_dict_%s'>", index, (value === undefined ? '' : value), row.columnId);
                                return "<div class='input-group'>" + html + "<span class='input-group-addon input-sm' onclick='selectDictTree(" + row.columnId + ", this)'><i class='fa fa-search'></i></span></div>";
                            },
                            cellStyle: function (value, row, index) {
                                return {css: {"cursor": "default"}};
                            }
                        }]
                };
                $.table.init(options);
            });

            // 当所有数据被加载时触发处理函数
            function onLoadSuccess(data) {
                $.fn.select2.defaults.set("theme", "bootstrap");
                $("select.form-control").each(function () {
                    $(this).select2().on("change", function () {
                        $(this).valid();
                    })
                })
                $(".check-box").each(function () {
                    $(this).iCheck({
                        checkboxClass: 'icheckbox-blue'
                    })
                })
            }

            // 当拖拽结束后处理函数
            function onReorderRow(data) {
                for (var i = 0; i < data.length; i++) {
                    $("#columns_sort_" + data[i].columnId).val(i + 1);
                }
            }

            $(function () {
                var tplCategory = $("#tplCategory option:selected").val();
                tplCategoryVisible(tplCategory);
                var genType = $('input[name="genType"]:checked').val();
                pathInfoVisible(genType);
            });

            $('#tplCategory').on('select2:select', function (event) {
                var tplCategory = $(event.target).val();
                tplCategoryVisible(tplCategory);
            });

            function tplCategoryVisible(tplCategory) {
                if ("crud" == tplCategory) {
                    $("#treeCode").select2("val", [""]);
                    $("#treeParentCode").select2("val", [""]);
                    $("#treeName").select2("val", [""]);
                    $("#otherInfo").addClass("hidden");
                    $("#subInfo").addClass("hidden");
                } else if ("tree" == tplCategory) {
                    $("#otherInfo").removeClass("hidden");
                    $("#treeCode").attr("required", "true");
                    $("#treeParentCode").attr("required", "true");
                    $("#treeName").attr("required", "true");
                    $("#subInfo").addClass("hidden");
                } else if ("sub" == tplCategory) {
                    $("#subInfo").removeClass("hidden");
                    $("#treeCode").select2("val", [""]);
                    $("#treeParentCode").select2("val", [""]);
                    $("#treeName").select2("val", [""]);
                    $("#subTableName").attr("required", "true");
                    $("#subTableFkName").attr("required", "true");
                    $("#otherInfo").addClass("hidden");
                }
            }

            $('input').on('ifChecked', function (event) {
                var genType = $(event.target).val();
                pathInfoVisible(genType);
            });

            function pathInfoVisible(genType) {
                if ("0" == genType) {
                    $("#genPath").val("/");
                    $("#pathinfo").addClass("hidden");
                } else if ("1" == genType) {
                    $("#pathinfo").removeClass("hidden");
                }
            }

            // 选择字典处理函数
            function selectDictTree(columnId, obj) {
                var dictType = $.common.nullToStr($(obj).parent().find("input").val());
                var url = ctx + "system/dict/selectDictTree/" + columnId + "/" + dictType;
                var options = {
                    title: '选择字典类型',
                    width: "380",
                    url: url,
                    callBack: doDictSubmit
                };
                $.modal.openOptions(options);
            }

            // 选择菜单处理函数
            function selectMenuTree() {
                var parentMenuId = $("#parentMenuId").val();
                var menuId = parentMenuId > 0 ? parentMenuId : 1;
                var url = ctx + "system/menu/selectMenuTree/" + menuId;
                var options = {
                    title: '菜单选择',
                    width: "380",
                    url: url,
                    callBack: doMenuSubmit
                };
                $.modal.openOptions(options);
            }

            function doDictSubmit(index, layero) {
                var body = $.modal.getChildFrame(index);
                var columnId = body.find('#columnId').val();
                var dictType = body.find('#dictType').val();
                $.modal.close(index);
                $("#columns_dict_" + columnId).val(dictType);
            }

            function doMenuSubmit(index, layero) {
                var body = $.modal.getChildFrame(index);
                $("#parentMenuId").val(body.find('#treeId').val());
                $("#parentMenuName").val(body.find('#treeName').val());
                $.modal.close(index);
            }
        </script>
    </body>
</html>


<!-- java类型 -->
<script id="javaTypeTpl" type="text/x-jquery-tmpl">
    <div>
    <select class='form-control' name='columns[${index}].javaType'>
        <option value="Long" {{if javaType==="Long"}}selected{{/if}}>Long</option>
        <option value="String" {{if javaType==="String"}}selected{{/if}}>String</option>
        <option value="Integer" {{if javaType==="Integer"}}selected{{/if}}>Integer</option>
        <option value="Double" {{if javaType==="Double"}}selected{{/if}}>Double</option>
        <option value="BigDecimal" {{if javaType==="BigDecimal"}}selected{{/if}}>BigDecimal</option>
        <option value="Date" {{if javaType==="Date"}}selected{{/if}}>Date</option>
    </select>
    </div>
</script>

<!-- 查询方式 -->
<script id="queryTypeTpl" type="text/x-jquery-tmpl">
    <div>
    <select class='form-control' name='columns[${index}].queryType'>
        <option value="EQ" {{if queryType==="EQ"}}selected{{/if}}>=</option>
        <option value="NE" {{if queryType==="NE"}}selected{{/if}}>!=</option>
        <option value="GT" {{if queryType==="GT"}}selected{{/if}}>></option>
        <option value="GTE" {{if queryType==="GTE"}}selected{{/if}}>>=</option>
        <option value="LT" {{if queryType==="LT"}}selected{{/if}}><</option>
        <option value="LTE" {{if queryType==="LTE"}}selected{{/if}}><=</option>
        <option value="LIKE" {{if queryType==="LIKE"}}selected{{/if}}>Like</option>
        <option value="BETWEEN" {{if queryType==="BETWEEN"}}selected{{/if}}>Between</option>
    </select>
    </div>
</script>

<!-- 显示类型 -->
<script id="htmlTypeTpl" type="text/x-jquery-tmpl">
    <div>
    <select class='form-control' name='columns[${index}].htmlType'>
        <option value="input" {{if htmlType==="input"}}selected{{/if}}>文本框</option>
        <option value="textarea" {{if htmlType==="textarea"}}selected{{/if}}>文本域</option>
        <option value="select" {{if htmlType==="select"}}selected{{/if}}>下拉框</option>
        <option value="radio" {{if htmlType==="radio"}}selected{{/if}}>单选框</option>
        <option value="checkbox" {{if htmlType==="checkbox"}}selected{{/if}}>复选框</option>
        <option value="summernote" {{if htmlType==="summernote"}}selected{{/if}}>富文本</option>
        <option value="datetime" {{if htmlType==="datetime"}}selected{{/if}}>日期控件</option>
        <option value="upload" {{if htmlType==="upload"}}selected{{/if}}>上传控件</option>
    </select>
    </div>
</script>
